import { makeOptionsRule, makeRequiredRule } from '../../../utils/index'

const label = '单选'
const name = 'radio'
let i = 1
const uniqueId = () => `${name}${i++}`
export default {
  icon: 'icon-radio',
  label,
  name,
  rule() {
    return {
      type: name,
      field: uniqueId(),
      title: label,
      info: '',
      effect: {
        fetch: ''
      },
      props: {},
      options: [
        { value: '1', label: '选项1' },
        { value: '2', label: '选项2' }
      ]
    }
  },
  props() {
    return [makeRequiredRule(), makeOptionsRule('options')]
  }
}
